package com.niit.ssmvc_chapter04.service.impl;

import com.niit.ssmvc_chapter04.dao.StudentInfo20Dao;
import com.niit.ssmvc_chapter04.entity.StudentInfo20;
import com.niit.ssmvc_chapter04.service.StudentInfo20Service;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 200720班同学基本信息(StudentInfo20)表服务实现类
 *
 * @author
 * @since 2022-04-14 10:47:11
 */
@Service("studentInfo20Service")
public class StudentInfo20ServiceImpl implements StudentInfo20Service {
    @Resource
    private StudentInfo20Dao studentInfo20Dao;


    @Override
    public StudentInfo20 queryById(String id) {
        return studentInfo20Dao.queryById(id);
    }


    /**
     * 新增数据
     *
     * @param studentInfo20 实例对象
     * @return 实例对象
     */
    @Override
    public StudentInfo20 insert(StudentInfo20 studentInfo20) {
        studentInfo20Dao.insert(studentInfo20);
        return studentInfo20;
    }

    @Override
    public StudentInfo20 update(StudentInfo20 studentInfo20) {
        studentInfo20Dao.update(studentInfo20);
        return studentInfo20;
    }

    /**
     * 通过主键删除数据
     *
     * @param 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(String id) {
        return studentInfo20Dao.deleteById() > 0;
    }

    @Override
    public int queryCount() {
        return studentInfo20Dao.queryCount();
    }

    @Override
    public List<StudentInfo20> queryByName(StudentInfo20 info) {
        return studentInfo20Dao.queryByName(info);
    }

    @Override
    public StudentInfo20 queryOne(StudentInfo20 studentInfo20) {
        return studentInfo20Dao.queryOne(studentInfo20);
    }
}
